package com.bw.mapper;

import com.bw.domain.Role;
import com.bw.domain.TbMenu;
import com.bw.domain.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: TaoShiHao
 * @Date: 2025/3/12 15:14
 * @Description:
 **/
public interface UserMapper {
    @Select("select * from t_user where username=#{username}")
    User login(String username);

    List<Role> listRoleByUserId(@Param("id") Integer id);

    List<TbMenu> listMenuByUserId(@Param("id") Integer id);

    List<User> list(User user);

    @Select("select * from t_role")
    List<Role> listRole();

    @Select("select  count(*) from t_user  where username=#{username}")
    int checkName(String username);

    void add(User user);

    void addUserRole(@Param("userId") Integer id,@Param("roleId") String authId);
}
